<!DOCTYPE html>
<html>
<head>
  <title>Worker pool in the browser</title>

  <script src="../../dist/workerpool.js"></script>
</head>
<body>

<script>
  // create a worker pool
  var pool = workerpool.pool('../workers/browserWorker.js');

  // create a proxy
  pool.proxy()
      .then(function (proxy) {
        // execute a function via the proxy
        return proxy.fibonacci(10);
      })
      .then(function (result) {
        document.write('Result: ' + result + '<br>'); // outputs 55
      })
      .catch(function (err) {
        document.write('Result: ' + err);
      });

</script>

</body>
</html>